import java.util.LinkedList;
import java.util.Queue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-04-14
 * Time: 21:35
 */
//队列先进先出
public class Test {
    //循环数组实现队列
    public static void main(String[] args) {
        MyCircleQueue myCircleQueue = new MyCircleQueue(10);
        myCircleQueue.enQueue(1);
        myCircleQueue.enQueue(2);
        myCircleQueue.enQueue(3);
        myCircleQueue.enQueue(4);

        System.out.println(myCircleQueue.Front());
        System.out.println(myCircleQueue.deQueue());
        System.out.println(myCircleQueue.Front());
        System.out.println(myCircleQueue.rear);
    }
    //MyQueue
    public static void main2(String[] args) {
        MyQueue myQueue = new MyQueue();
        myQueue.offer(1);
        myQueue.offer(2);
        myQueue.offer(3);
        myQueue.offer(4);

        System.out.println(myQueue.useSize);
        System.out.println(myQueue.peek());
        System.out.println(myQueue.poll());
        System.out.println(myQueue.peek());
        System.out.println(myQueue.useSize);
    }
    //java的队列
    public static void main1(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        queue.offer(1);
        queue.add(2);

        System.out.println(queue.peek());
        System.out.println(queue.poll());
        System.out.println(queue.peek());
    }
}
